import CryptoJS from "crypto-js";

const finalKey = CryptoJS.enc.Utf8.parse("h4k4f557f8gt5r27");

const finalIv = CryptoJS.enc.Utf8.parse("2607789674lvshih");

export function encrypt(data) {
  let key = finalKey;
  let iv = finalIv;
  let srcs = CryptoJS.enc.Utf8.parse(data);
  let encrypted = CryptoJS.AES.encrypt(srcs, key, {
    iv: iv,
    mode: CryptoJS.mode.CBC,
    padding: CryptoJS.pad.Pkcs7
  });
  return CryptoJS.enc.Base64.stringify(encrypted.ciphertext);
}
